package com.kawins.spring.valid.util;

/**
 * 正则表达式大全
 *
 * @author rankai
 *         createTime 2017-04-2017/4/26 14:12
 */
public class RegexUtil {

    /**
     * email正则表达式(以验证)
     */
    public static final String REGEX_EMAIL = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";

    /**
     * 手机号正则表达式
     */
    public static final String REGEX_PHONE = "^[1][3,4,5,7,8][0-9]{9}$";

    /**
     * 中文正则表达式
     */
    public static final String REGEX_CHINESE = "[\\u4E00-\\u9FA5]+";

    /**
     * JSON正则表达式
     */
    public static final String REGEX_JSON = "[^\\\"\\\\\\n\\r]*\\\"|true|false|null|-?\\\\d+(?:\\\\.\\\\d*)?(?:[eE][+\\\\-]?\\\\d+)?";

    /**
     * URL正则表达式
     */
    public static final String REGEX_URL = "^((https|http|ftp|rtsp|mms)?:\\/\\/)[^\\s]+";

    /**
     * 用户名正则表达式
     */
    public static final String REGEX_USERNAME = "[A-Za-z0-9_\\-\\u4e00-\\u9fa5]+";

    /**
     * IP正则表达式
     */
    public static final String REGEX_IP = "(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|" +
            "[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)";

    public static void main(String[] args) {
        System.out.println(ValidUtil.validJson("{\"creditCardOverdueCount\":\"4455465\",\"applyAmount\":\"23\",\"loanUse\":0,\"age\":\"23\",\"education\":0,\"residence\":0,\"sex\":0,\"ownedPropertyQuantity\":\"23\",\"mortgagePropertyQuantity\":\"23\",\"childrenEducation\":3,\"mortgateBalance\":\"23\",\"marriage\":0,\"loanBalance\":\"23\",\"liquidAssents\":\"23\",\"credit\":2,\"businessYears\":\"23\",\"loanOverdueCount\":\"23\",\"numOfEconomicDependence\":\"23\",\"totalAssents\":\"45\",\"otherIncome\":\"656\",\"fixedAssents\":\"544\",\"annualDisposableCapital\":\"546\",\"totalLiabilities\":\"546\",\"mortgageRemaining\":\"56\",\"ownedCarsQuantity\":\"456\",\"stock\":\"456\",\"paymentByPrivateUse\":\"456\",\"collateralValuation\":\"456\",\"annualIncome\":\"456\",\"spouseIncome\":\"546\",\"ownersEquity\":\"456\",\"shortTermLiabilities\":\"456\",\"articleCategory\":1}\n"));
    }
}
